#include<bits/stdc++.h>
#define y1 Y1
#define fi first
#define endl "\n"
#define se second
#define PI acos(-1)
#define int long long
#define pb(x) push_back(x)
#define PII pair<int, int>
#define Yes cout << "Yes\n";
#define No cout << "No\n";
#define YES cout << "YES\n";
#define NO cout << "NO\n";
#define _for(i, a, b) for(int i = a; i <= b; ++i)
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
using namespace std;

const int N = 2e5 + 10;

int a[N];
int n, m;
string s;
map<int, int>mp;

signed main() {
	IOS;
	cin >> n;
	_for(i, 1, n) {
		cin >> a[i];
		mp[a[i]]++;
	}
	_for(i, 1, n) {
		cin >> a[i];
		mp[a[i]]++;
	}
	
	for(auto i : mp) {
		if(i.se % 2) {
			cout << -1 << endl;
			return 0;
		}
	}
	int cnt = 0;
	for(auto i : mp) {
		int sum = i.se;
		for(int j = 1; j <= sum / 2; ++ j ) {
			a[++cnt] = i.fi;
		}
	}
	
	for(int i= 1; i <= n; ++ i ) {
		cout << a[i] << ' ';
	}
	cout << endl;
	_for(i, 1, n) {
		cout << a[i] << ' ';
	}
	return 0;
}

